<div class="modal-header">
  <div class="modal-title">{{ record.ID > 0 ? '编辑' + '' : '添加' }}</div>
</div>

<div *ngIf="i">
  <form nz-form [formGroup]="validateForm">
    <input nz-input hidden formControlName="ID" />
    <input nz-input hidden formControlName="sort" [(ngModel)]="record['sort']" />
    <input nz-input hidden formControlName="itemId" [(ngModel)]="record['itemId']" />
    <input nz-input hidden formControlName="skuId" [(ngModel)]="record['skuId']" />
    <input nz-input hidden formControlName="orderSn" [(ngModel)]="record['orderSn']" />
    <input nz-input hidden formControlName="orderId" [(ngModel)]="record['orderId']" />
    <div nz-row [nzGutter]="24">
      <div nz-col [nzSpan]="20">
        <nz-form-item>
          <nz-form-label [nzSpan]="8" nzFor="link">购买链接</nz-form-label>
          <nz-form-control [nzSpan]="16">
            <input nz-input formControlName="link" placeholder="请输入购买链接" [(ngModel)]="record['link']" />
          </nz-form-control>
        </nz-form-item>
      </div>

      <div nz-col [nzSpan]="20">
        <nz-form-item>
          <nz-form-label [nzSpan]="8" nzFor="isDefault">是否默认</nz-form-label>
          <nz-form-control [nzSpan]="16">
            <nz-radio-group formControlName="isDefault" [(ngModel)]="record['isDefault']">
              <label nz-radio [nzValue]="0">否</label>
              <label nz-radio [nzValue]="1">是</label>
            </nz-radio-group>
          </nz-form-control>
        </nz-form-item>
      </div>

      <div nz-col [nzSpan]="20">
        <nz-form-item>
          <nz-form-label [nzSpan]="8" nzFor="type">类型</nz-form-label>
          <nz-form-control [nzSpan]="16" nzErrorTip="请选择所属类型！">
            <nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择所属类型" formControlName="type" [(ngModel)]="record['type']">
              <!--<nz-option [nzLabel]="'无'" [nzValue]="0" [nzDisabled]=""></nz-option>-->
              <nz-option *ngFor="let c of purchase_types" [nzLabel]="c['type_name']" [nzValue]="c['id']"></nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>
      </div>
    </div>
  </form>
</div>

<div class="modal-footer">
  <button nz-button type="button" (click)="close()">关闭</button>
  <button
    nz-button
    type="submit"
    nzType="primary"
    (click)="save(validateForm.value)"
    [disabled]="!validateForm.valid"
    [nzLoading]="http.loading"
    >保存
  </button>
</div>
